
<!DOCTYPE html>
<html>
<head lang="zh">
    <meta charset="UTF-8">
    <!--#include virtual="/public/inc/head.html"-->
    <title>销售团队管理</title>
    <!--#include virtual="/public/inc/seajs.html" -->
    <link rel="stylesheet" type="text/css" href="/ydxs_static/public/css/css.css" />
    <link rel="stylesheet" type="text/css" href="/public/css/index.css" />
    <style>
        .right-panel { width: 100%; }
        /* 自适应布局 */
        .auto-wrap { width: 100%;}
        .auto-wrap-con {  }
        .options li {float:left; cursor: pointer; margin: 0 5px;}
        .options li a {color: #3c93d7; text-decoration: none;}
        .options li a:hover { text-decoration: underline;}
        .left-list li:hover, .left-list li.selected { margin-right: 1px; }
        .add_member li a{color:#333;display: inline-block;padding: 0 15px;}
        #type_tree ul li{border-bottom: 1px solid #d9d9d9;}
        #type_tree ul li.selected{background-color: #fff8ee;}
        #type_tree ul li.selected .left-list-op{display: block !important;}
        .left-list-text{width: 130px;}
        .menu-arrow .top-userinfo-menu{display: none;}
        .menu-arrow:hover .top-userinfo-menu{display: block;z-index: 999;}
        input[type="text"]::-ms-clear{display: none;}
        .dropdown-menu {
            position: absolute;
            top: 100%;
            left: 0;
            z-index: 1000;
            float: left;
            font-size: 14px;
            text-align: left;
            list-style: none;
            background-color: #fff;
            -webkit-background-clip: padding-box;
            background-clip: padding-box;
            border: 1px solid #ccc;
            border: 1px solid rgba(0,0,0,.15);
            border-radius: 4px;
            -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
            box-shadow: 0 6px 12px rgba(0,0,0,.175);
        }
        .dropdown-menu:after, .dropdown-menu:before {
            border: solid transparent;
            content: ' ';
            height: 0;
            left: 50%;
            position: absolute;
            width: 0;
            top: 0;
        }
        /*
        .dropdown-menu:before{
            border-width: 10px;
            border-top-color: #e0e0e0;
            margin-left: -10px;
        }
        .dropdown-menu:after{
            border-width: 9px;
            border-top-color: #fcfcfc;
            margin-left: -9px;
        }
        */
        .dropdown-menu>li:first-child>a{
            border-top: 0;
        }
        .dropdown-menu>li>a {
            display: block;
            padding: 3px 10px;
            border-top: 1px solid #d9d9d9;
            clear: both;
            font-weight: 400;
            line-height: 1.42857143;
            color: #333;
            white-space: nowrap;
        }
        .dropdown-menu>li>a:hover{
            background-color:#FFF8EE;
        }
        .edit-more{
            position:relative;
            border-left: 1px solid #d9d9d9;
        }
        .edit-more .edit-more-icon{
            padding: 0 5px;
            transform: translateX(3px) rotate(90deg);
        }
        .edit-more:hover{
            background-color:#D8D8D8;
        }
        .no-project span{
            width: 174px;
            height: 216px;
            background: url(/static_public/images/icon/noproject.png) no-repeat center top;
        }
        .bt1{
            border-top: 1px solid #d9d9d9;
        }
    </style>
</head>
<body data-func-codes="00002702" data-permission="00002702-00">
<!--#include virtual="/public/inc/top_main.html" -->
    <div class="container">
        <div class="wrap clearfix">
            <!--#include virtual="/public/inc/side_main.html" -->
            <div class="content">
                <div class="auto-wrap" ng-cloak ng-controller="SalesTeamController">
                    <div class="auto-wrap-con">
                        <div class="fl right-panel">
                            <div class="mt15 clearfix">
                                <div class="fl f14 clearfix">
                                    <span class="fl lh30 ml5">选择项目：</span>
                                    <div style="width:514px" class="fl limit-ie f12" ui-project-tree data="projectList" ng-model="curProjectId"></div>                                  
                                </div>
                                <div class="fr btn-group ng-hide" ng-show="curProjectId">
                                    <div class="menu-arrow fl relative">
                                        <a href="javascript:;" class="btn permission p-00002702-01-inline-block">导入销售团队</a>
                                    <div class="top-userinfo-menu" style="right: 2px;top: 25px;">
                                        <div class="top-userinfo-menu-list text-center">
                                            <a href="{{tplDownLoadUrl}}" target="_blank">模版下载</a>
                                            <a href="javascript:;" ui-dialog="导入销售团队" ui-dialog-url="dialog/import_team.html" ui-dialog-cache="false" ui-dialog-init="teamImporter.init($dialogScope,$dialog)">导入销售团队</a>
                                        </div>
                                        <i class="top-userinfo-menu-arrow"></i>
                                    </div>
                                        </div>
                                    <a href="javascript:;" class="fl btn mr5 ng-hide permission p-00002702-01-inline-block"
                                       ui-dialog="引入其他项目团队"
                                       ui-dialog-url="dialog/import_proteam.html"
                                       ui-dialog-cache="false"
                                       ui-dialog-init="proTeamImporter.init($dialogScope)"
                                       ui-dialog-ok="importProTeam($dialogScope,$dialog)"
                                       ng-show="noMember && noTeam" style="margin-right: 0px;">引入其他项目团队</a>
                                    <a href="{{memberExportUrl}}" class="btn permission p-00002702-99-inline-block" target="_blank">导出项目成员帐号</a>
                                </div>
                            </div>
                            <div class="mt10 clearfix ng-hide" ng-show="curProjectId">
                                <div class="">
                                    <div class="row clearfix f14">
                                        <div class="fl" style="padding-left:0px;line-height: 25px;margin: 8px 0 0 15px;">项目经理：</div>
                                        <div class="fl" style="padding-left:0px;">
                                            <ul class="add_member clearfix">
                                                <li class="" ng-repeat="manager in salesTeamInfo.project_managers">
                                                    <a href="javascript:;"
                                                       class="fl edit-name"
                                                        ui-dialog="编辑"
                                                        ui-dialog-url="dialog/edit_salesman.html"
                                                        ui-dialog-cache="false"
                                                        ui-dialog-init="salesEditor.init($dialogScope,manager)"
                                                        ui-dialog-ok="updateSaler($dialogScope,$dialog)">{{manager.user_name}}</a>
                                                    <div class="fl edit-more" ng-mouseenter="editMore=true" ng-mouseleave="editMore=false">
                                                        <a href="javascript:;" class="edit-more-icon permission p-00002702-01-inline-block">...</a>
                                                        <ul class="dropdown-menu" ng-show="editMore" >
                                                            <li><a href="javascript:;"
                                                                   ui-dialog="编辑"
                                                                   ui-dialog-url="dialog/edit_salesman.html"
                                                                   ui-dialog-cache="false"
                                                                   ui-dialog-init="salesEditor.init($dialogScope,manager)"
                                                                   ui-dialog-ok="updateSaler($dialogScope,$dialog)">编辑</a></li>
                                                            <li><a href="javascript:;" ng-click="moveOutTeam(manager.team_user_id)">移出团队</a></li>
                                                        </ul>
                                                    </div>
                                                </li>
                                                <li class="add_mem">
                                                    <button i="add" class="ui-dialog-add permission p-00002702-01-block" title="添加" ui-dialog="选择成员" ui-dialog-url="dialog/add_salesman.html" ui-dialog-cache="false"
                                                    ui-dialog-init="initAddMemberDialog($dialogScope)" ui-dialog-ok="createProjectManagers($dialogScope)">+</button>
                                                </li>
                                            </ul>
                                        </div>
                                    </div>
                                    <p class="mt10 clearfix">
                                        <a href="javascript:;" class="btn permission p-00002702-01-inline-block" id="btn_add_type" ui-dialog="组建团队" ui-dialog-url="dialog/add_team.html" ui-dialog-cache="false"
                                           ui-dialog-ok="createTeam($data,$dialog,$dialogScope)"
                                           >组建团队</a>
                                        <a href="javascript:;" class="btn permission p-00002702-01-inline-block"
                                           ui-dialog="组织调整"
                                           ui-dialog-url="dialog/adjust_group.html"
                                           ui-dialog-data="salesTeamInfo"
                                           ui-dialog-cache="false"
                                           ui-dialog-init="groupAdjuster.init($dialogScope)"
                                           ui-dialog-ok="adjustGroup($dialog)"
                                           ng-show="!noTeam && (salesTeamInfo.teams.length > 1 || (salesTeamInfo.teams.length=== 1 && salesTeamInfo.teams[0].groups.length > 1))">组织调整</a>
                                        <a href="javascript:;"
                                           class="btn"
                                           style="color: #ff7713;background-color: #fff;"
                                           ng-cloak
                                           ng-show="historys.historyMembersCount > 0"
                                           ui-dialog="查看历史成员"
                                           ui-dialog-url="dialog/history_members.html"
                                           ui-dialog-cache="false"
                                           ui-dialog-init="historys.init($dialogScope)"
                                           >查看历史成员</a>
                                           <a href="javascript:;"
                                           class="btn"
                                           style="color: #ff7713;background-color: #fff;"
                                           ng-cloak
                                           ng-show="notInTeamViewer.memberCount > 0"
                                           ui-dialog="查看不在销售团队的销售员"
                                           ui-dialog-url="dialog/notinteam_members.html"
                                           ui-dialog-cache="false"
                                           ui-dialog-init="notInTeamViewer.init($dialogScope)"
                                           >查看不在销售团队的销售员</a>
                                    </p>
                                </div>
                                <div class="row clearfix relative" ng-if="noTeam" style="margin-top:-10px;">
                                    <div class="col-md-12 team_project" ng-if="currentTeam" style="min-height: 300px;">
                                        <div style="margin-bottom: 30px;min-height: 600px;">
                                            <div class="border mt15 clearfix">
                                                <div class="fl clearfix" style="width: 100%;">
                                                    <div class="fl text-right" style="line-height: 25px;margin: 8px 0px;width: 60px; padding-top:10px;padding-bottom: 10px;">销售员：</div>
                                                    <div class="fl" style="padding-left: 5px; padding-top:10px;padding-bottom: 10px;">
                                                        <ul class="add_member clearfix">
                                                            <li ng-repeat="saler in currentTeam.groups[0].salers">
                                                                <a href="javascript:;"
                                                                   class="fl"
                                                                    ui-dialog="编辑"
                                                                    ui-dialog-url="dialog/edit_salesman.html"
                                                                    ui-dialog-cache="false"
                                                                    ui-dialog-init="salesEditor.init($dialogScope,saler)"
                                                                    ui-dialog-ok="updateSaler($dialogScope,$dialog)">{{saler.user_name}}</a>
                                                                <div class="fl edit-more" ng-mouseenter="editMore=true" ng-mouseleave="editMore=false">
                                                                    <a href="javascript:;" class="edit-more-icon permission p-00002702-01-inline-block">...</a>
                                                                    <ul class="dropdown-menu" ng-show="editMore" >
                                                                        <li><a href="javascript:;"
                                                                               ui-dialog="编辑"
                                                                               ui-dialog-url="dialog/edit_salesman.html"
                                                                               ui-dialog-cache="false"
                                                                               ui-dialog-init="salesEditor.init($dialogScope,saler)"
                                                                               ui-dialog-ok="updateSaler($dialogScope,$dialog)">编辑</a></li>
                                                                        <li><a href="javascript:;" ng-click="moveOutTeam(saler.team_user_id)">移出团队</a></li>
                                                                    </ul>
                                                                </div>
                                                            </li>
                                                            <li class="add_mem">
                                                                <button i="add" class="ui-dialog-add permission p-00002702-01-block" title="添加" ui-dialog="选择成员" ui-dialog-url="dialog/add_salesman.html" ui-dialog-cache="false"
                                                                ui-dialog-init="initAddMemberDialog($dialogScope)" ui-dialog-ok="createSalers($dialogScope,$dialog,group.group_id)">+</button>
                                                            </li>
                                                        </ul>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="row clearfix relative mt25" ng-if="!noTeam">
                                    <div class="col-md-3 h652 ">
                                        <div class="border pl10 bgcf7 clearfix">
                                            <span class="form-cell fl ng-binding" valign="top">团队名称</span>
                                        </div>
                                        <div id="type_tree" class="border" style="border-top: none;min-height: 300px; max-height: 500px;overflow: auto;">
                                            <ul>
                                                <li class="clearfix {{team.team_id === currentTeam.team_id ?'selected':''}}" ng-repeat="team in salesTeamInfo.teams" ng-click="setCurrentTeam(team,$index)"
                                                ng-mouseover="team.checked = true;" ng-mouseleave="team.checked = false;">
                                                    <span class="left-list-text" ng-cloak>{{team.team_name}}</span>
                                                    <span class="fr left-list-op" ng-show="team.checked">
                                                        <a href="javascript:;" class="permission p-00002702-01-inline" ui-dialog="编辑团队" ui-dialog-cache="false" ui-dialog-data="team" ui-dialog-url="dialog/add_team.html" ui-dialog-ok="updateTeam($data,$dialog,team.team_id)">
                                                            <i class="icon-op icon-op-edit"></i>
                                                        </a>
                                                        <a href="javascript:;" class="permission p-00002702-01-inline" ui-confirm ui-confirm-title="删除" ui-confirm-ok="deleteTeam(team.team_id)" ui-confirm-message="确定要删除所选团队吗？">
                                                            <i class="icon-op icon-op-del"></i>
                                                        </a>
                                                    </span>
                                                </li>
                                            </ul>
                                        </div>
                                    </div>
                                    <div class="col-md-9 border team_project" ng-if="currentTeam" style="min-height: 333px;padding: 0;">
                                        <div style="margin-bottom: 30px;">
                                            <div class="clearfix mt5" ng-if="currentTeam.team_id" style="padding: 0 5px 0 10px;margin-bottom: 5px;">
                                                <span class="fl f14 lh30 text-right mt5" style="width: 70px;">团队经理：</span>
                                                <ul class="add_member fl clearfix">
                                                    <li ng-repeat="manager in currentTeam.team_managers">
    													<a href="javascript:;"
                                                           class="fl"
                                                            ui-dialog="编辑"
                                                            ui-dialog-url="dialog/edit_salesman.html"
                                                            ui-dialog-cache="false"
                                                            ui-dialog-init="salesEditor.init($dialogScope,manager)"
                                                            ui-dialog-ok="updateSaler($dialogScope,$dialog)">{{manager.user_name}}</a>
                                                        <div class="fl edit-more" ng-mouseenter="editMore=true" ng-mouseleave="editMore=false">
                                                            <a href="javascript:;" class="edit-more-icon permission p-00002702-01-inline-block">...</a>
                                                            <ul class="dropdown-menu" ng-show="editMore" >
                                                                <li><a href="javascript:;"
                                                                       ui-dialog="编辑"
                                                                       ui-dialog-url="dialog/edit_salesman.html"
                                                                       ui-dialog-cache="false"
                                                                       ui-dialog-init="salesEditor.init($dialogScope,manager)"
                                                                       ui-dialog-ok="updateSaler($dialogScope,$dialog)">编辑</a></li>
                                                                <li><a href="javascript:;" ng-click="moveOutTeam(manager.team_user_id)">移出团队</a></li>
                                                            </ul>
                                                        </div>
                                                    </li>
                                                    <li class="add_mem">
                                                        <button i="add" class="ui-dialog-add permission p-00002702-01-block" title="添加" ui-dialog="选择成员" ui-dialog-url="dialog/add_salesman.html" ui-dialog-cache="false"
                                                        ui-dialog-init="initAddMemberDialog($dialogScope,currentTeam)" ui-dialog-ok="createTeamManagers($dialogScope,$dialog)">+</button>
                                                    </li>
                                                </ul>
                                                <a href="javascript:;" class="fr mt5 btn btn-yellow permission p-00002702-01-inline-block" ui-dialog="添加销售组" ui-dialog-url="dialog/add_group.html" ui-dialog-cache="false"
                                                   ui-dialog-ok="createSaleGroup($data,$dialog)">新建团队分组</a>
                                                </div>
                                            <div ng-repeat="group in currentTeam.groups" ng-class="{bt1:$index === 0}" style="border-bottom: 1px solid #d9d9d9;">
                                                <div class="border-bottom pl10 bgcf7 clearfix" ng-if="group.group_id">
                                                    <span class="form-cell fl" valign="top">{{group.group_name}}</span>
                                                    <span class="fr left-list-op">
                                                        <a href="javascript:;" class="permission p-00002702-01-inline" ui-dialog="编辑销售组" ui-dialog-data="group" ui-dialog-url="dialog/add_group.html" ui-dialog-ok="updateSaleGroup($data,$dialog,group.group_id)" ui-dialog-cache="false">
                                                    <i class="icon-op icon-op-edit"></i>
                                                </a>
                                                        <a href="javascript:;" class="permission p-00002702-01-inline" ui-confirm ui-confirm-title="删除" ui-confirm-ok="deleteSaleGroup(group.group_id)" ui-confirm-message="确定删除该小组吗？">
                                                    <i class="icon-op icon-op-del"></i>
                                                </a>
                                                    </span>
                                                </div>
                                                <div class="row clearfix pl10" ng-if="group.group_id">
                                                    <div class="fl text-right" style="line-height: 25px;margin: 8px 0px;width: 70px">组长：</div>
                                                    <div class="fl" style="padding-left: 0px;">
                                                        <ul class="add_member clearfix">
                                                            <li ng-repeat="manager in group.group_managers">
                                                                <a href="javascript:;"
                                                                   class="fl"
                                                                    ui-dialog="编辑"
                                                                    ui-dialog-url="dialog/edit_salesman.html"
                                                                    ui-dialog-cache="false"
                                                                    ui-dialog-init="salesEditor.init($dialogScope,manager)"
                                                                    ui-dialog-ok="updateSaler($dialogScope,$dialog)">{{manager.user_name}}</a>
                                                                <div class="fl edit-more" ng-mouseenter="editMore=true" ng-mouseleave="editMore=false">
                                                                    <a href="javascript:;" class="edit-more-icon permission p-00002702-01-inline-block">...</a>
                                                                    <ul class="dropdown-menu" ng-show="editMore" >
                                                                        <li><a href="javascript:;"
                                                                               ui-dialog="编辑"
                                                                               ui-dialog-url="dialog/edit_salesman.html"
                                                                               ui-dialog-cache="false"
                                                                               ui-dialog-init="salesEditor.init($dialogScope,manager)"
                                                                               ui-dialog-ok="updateSaler($dialogScope,$dialog)">编辑</a></li>
                                                                        <li><a href="javascript:;" ng-click="moveOutTeam(manager.team_user_id)">移出团队</a></li>
                                                                    </ul>
                                                                </div>
                                                            </li>
                                                            <li class="add_mem">
                                                                <button i="add" class="ui-dialog-add permission p-00002702-01-block" title="添加" ui-dialog="选择成员" ui-dialog-url="dialog/add_salesman.html" ui-dialog-cache="false"
                                                                ui-dialog-init="initAddMemberDialog($dialogScope)" ui-dialog-ok="createGroupLeaders($dialogScope,$dialog,group.group_id)">+</button>
                                                            </li>
                                                        </ul>
                                                    </div>
                                                </div>
                                                <div class="row clearfix pl10">
                                                    <div class="fl text-right" style="line-height: 25px;margin: 8px 0px;width: 70px;">销售员：</div>
                                                    <div class="fl" style="padding-left: 0px;">
                                                        <ul class="add_member clearfix">
                                                            <li ng-repeat="saler in group.salers">
                                                                <a href="javascript:;"
                                                                   class="fl"
                                                                    ui-dialog="编辑"
                                                                    ui-dialog-url="dialog/edit_salesman.html"
                                                                    ui-dialog-cache="false"
                                                                    ui-dialog-init="salesEditor.init($dialogScope,saler)"
                                                                    ui-dialog-ok="updateSaler($dialogScope,$dialog)">{{saler.user_name}}</a>
                                                                <div class="fl edit-more" ng-mouseenter="editMore=true" ng-mouseleave="editMore=false">
                                                                    <a href="javascript:;" class="edit-more-icon permission p-00002702-01-inline-block">...</a>
                                                                    <ul class="dropdown-menu" ng-show="editMore" >
                                                                        <li><a href="javascript:;"
                                                                               ui-dialog="编辑"
                                                                               ui-dialog-url="dialog/edit_salesman.html"
                                                                               ui-dialog-cache="false"
                                                                               ui-dialog-init="salesEditor.init($dialogScope,saler)"
                                                                               ui-dialog-ok="updateSaler($dialogScope,$dialog)">编辑</a></li>
                                                                        <li><a href="javascript:;" ng-click="moveOutTeam(saler.team_user_id)">移出团队</a></li>
                                                                    </ul>
                                                                </div>
                                                            </li>
                                                            <li class="add_mem">
                                                                <button i="add" class="ui-dialog-add permission p-00002702-01-block" title="添加" ui-dialog="选择成员" ui-dialog-url="dialog/add_salesman.html" ui-dialog-cache="false"
                                                                ui-dialog-init="initAddMemberDialog($dialogScope)" ui-dialog-ok="createSalers($dialogScope,$dialog,group.group_id)">+</button>
                                                            </li>
                                                        </ul>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div  class="no-data no-project" ng-show="notProject">
                                <span></span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </div>
    </div>
    <!--#include virtual="/public/inc/footer.html" -->

    <script type="text/javascript">
        seajs.use(['/public/js/service/user_manage/salesteam_manage']);

    </script>
</body>

</html>
